package com.yeming.flink.practice

import org.apache.flink.api.scala._

import scala.util.Random

object TestStation {

  def main(args: Array[String]): Unit = {
    //加载环境
    val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment
    //读取数据源以及数据操作
    env.setParallelism(1)
    val path: String = getClass.getResource("/station.csv").getPath
    val array = Array("赵","钱","孙","李","周","吴","郑","王")
    val city = Array("北京","上海","杭州","信阳","郑州","芜湖","合肥","深圳")
    var i = 1
    var r = new Random()
    env.readTextFile(path).distinct().map(num => {
      var name = array(r.nextInt(8)) + i
      i += 1
      (num, name + "," + city(r.nextInt(8)))
    }).print()
    //

    //数据流执行
  }



}
